package test.cassandra;

import java.util.List;

import com.datastax.driver.core.Cluster;
import com.datastax.driver.core.ResultSet;
import com.datastax.driver.core.Row;
import com.datastax.driver.core.Session;

public class App2 {

	public static void main(String[] args) {
		Cluster cluster = Cluster.builder().addContactPoint("127.0.0.1").build();
		Session session = cluster.connect("mykeyspace");
		
		ResultSet rs = session.execute("select * from schools");
		ResultSet rs2 = session.execute("select * from classes");
//		ResultSet rs3 = session.execute("select * from users");
		
		print(rs);
		print(rs2);
//		print(rs3);
		
//		session.execute("drop table schools");
//		session.execute("drop table classes");
//		session.execute("drop table users");
		
		session.close();
		cluster.close();
	}
	
	static void print(ResultSet rs) {
		List<Row> list = rs.all();
		for(Row row:list) {
			System.out.println(row);
		}
	}

}
